x86: Fix clip_to_limit().
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 9 Nov 2009 20:43:40 +0000 (20:43 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 9 Nov 2009 20:43:40 +0000 (20:43 +0000)
commitabe3377eb20289b008f46682d91e20f42e3f08af
tree363a88ab2072cf2cc40d21286ba3300653fbf768
parentb6a5bfafee6db90db85d035b3d512ad2223ad643
x86: Fix clip_to_limit().

There are issues in updating the e820 map in the middle of a loop that
iterates over it. For example, after memmove(&e820.map[i],
&e820.map[i+1], ...), the original e820.map[i+1] become current
e820.map[i] but the next loop count is i+1, so the original
e820.map[i+1] will be skipped.

Fix and clarify the code by making a double loop.

Original bug discovery and fix by Xiao Guangrong <ericxiao.gr@gmail.com>

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
xen/arch/x86/e820.c